<?php use_helper('Javascript') ?>
<?php $total=0; ?>
<div id="list" class="list">
<div class="product2">
      <div class=image>
        Image
      </div>
      <div class=description>
        Descritpion
      </div>
      <div class=quantity>
        Quantity
      </div>
      <div class=unit_price>
        Price
      </div>
      <div class=total_price>
        Total price
      </div>
    </div>
  <?php foreach ($sf_user->getAttribute('cart') as $product_id => $quantity): ?>
    <div class=product2>
      <div class=image>
         <?php echo image_tag(ProductsPeer::getImage($product_id), array(      
        'class' => 'cart-items',
        'id'    => 'item_'.$product_id,
        'style' => 'position:relative')) ?> 
        <?php echo draggable_element('item_'.$product_id, array('revert' => true)) ?>
      </div>
      <div class=description>
        <?php echo ProductsPeer::getName($product_id) ?><br/>
        <?php echo ProductsPeer::getModel($product_id) ?><br/>
      </div>
      <div class=quantity>
      
        <?php echo link_to_remote(image_tag('frontend/moins.jpg', 'id=moins'), array(
          'update'     => 'list',
          'url'        => 'cart/removeAjax?id=product_'.$product_id
        )) ?>
        
        <?php echo '<input type=text name=quantity'.$product_id.' value='.$quantity.' size=1 />'; ?>
        
        <?php echo link_to_remote(image_tag('frontend/plus.jpg', 'id=plus'), array(
          'update'     => 'list',
          'url'        => 'cart/addAjax?id=product_'.$product_id
        )) ?>
        
      </div>
      <div class=unit_price>
        <?php echo ProductsPeer::getPrice($product_id) ?>
      </div>
      <div class=total_price>
        <?php echo ($quantity*ProductsPeer::getPrice($product_id)); ?>
      </div>
    </div>
    <?php $total+=$quantity*ProductsPeer::getPrice($product_id); ?>
  <?php endforeach; ?>
  <div class=product2>
    <div class=total_price>
        total price : <?php echo $total; ?>
    </div>
  </div>
</div>